package com.ruoyi.pims.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.pims.mapper.SalesOrdersMapper;
import com.ruoyi.pims.domain.SalesOrders;
import com.ruoyi.pims.service.ISalesOrdersService;
import com.ruoyi.common.core.text.Convert;

/**
 * 销售订单主Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-17
 */
@Service
public class SalesOrdersServiceImpl implements ISalesOrdersService 
{
    @Autowired
    private SalesOrdersMapper salesOrdersMapper;

    /**
     * 查询销售订单主
     * 
     * @param orderId 销售订单主主键
     * @return 销售订单主
     */
    @Override
    public SalesOrders selectSalesOrdersByOrderId(Long orderId)
    {
        return salesOrdersMapper.selectSalesOrdersByOrderId(orderId);
    }

    /**
     * 查询销售订单主列表
     * 
     * @param salesOrders 销售订单主
     * @return 销售订单主
     */
    @Override
    public List<SalesOrders> selectSalesOrdersList(SalesOrders salesOrders)
    {
        return salesOrdersMapper.selectSalesOrdersList(salesOrders);
    }

    /**
     * 新增销售订单主
     * 
     * @param salesOrders 销售订单主
     * @return 结果
     */
    @Override
    public int insertSalesOrders(SalesOrders salesOrders)
    {
        salesOrders.setCreateTime(DateUtils.getNowDate());
        return salesOrdersMapper.insertSalesOrders(salesOrders);
    }

    /**
     * 修改销售订单主
     * 
     * @param salesOrders 销售订单主
     * @return 结果
     */
    @Override
    public int updateSalesOrders(SalesOrders salesOrders)
    {
        salesOrders.setUpdateTime(DateUtils.getNowDate());
        return salesOrdersMapper.updateSalesOrders(salesOrders);
    }

    /**
     * 批量删除销售订单主
     * 
     * @param orderIds 需要删除的销售订单主主键
     * @return 结果
     */
    @Override
    public int deleteSalesOrdersByOrderIds(String orderIds)
    {
        return salesOrdersMapper.deleteSalesOrdersByOrderIds(Convert.toStrArray(orderIds));
    }

    /**
     * 删除销售订单主信息
     * 
     * @param orderId 销售订单主主键
     * @return 结果
     */
    @Override
    public int deleteSalesOrdersByOrderId(Long orderId)
    {
        return salesOrdersMapper.deleteSalesOrdersByOrderId(orderId);
    }
}
